import requests
from config import url


class Login(object):
    def __init__(self, url_path='/api/sys/login'):
        self.login_url = url + url_path

    def login(self, body):
        return requests.post(self.login_url, json=body)

    def token(self, body):
        resp = requests.post(self.login_url, json=body)
        token = resp.json().get('data')
        return token
